﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using IndexMarkSilverlightClient;
using System.ServiceModel;
using IndexMarkSilverlightClient.Classes;

namespace IndexMarkSilverlightClient
{
    public partial class App : Application
    {
        public App()
        {
            this.Startup += this.Application_Startup;
            this.UnhandledException += this.Application_UnhandledException;
            InitializeComponent();
        }

        MainPage _MP;

        private void Application_Startup(object sender, StartupEventArgs e)
        {
            this.RootVisual = _MP = new MainPage();
        }

        private void Application_UnhandledException(object sender,
            ApplicationUnhandledExceptionEventArgs e)
        {
            if (!System.Diagnostics.Debugger.IsAttached)
            {
                e.Handled = true;
                _MP.ShowError(e.ExceptionObject);
                About._ErrList.Add(e.ExceptionObject.LastMessage());
                //ChildWindow errorWin = new ErrorWindow(e.ExceptionObject);
                //errorWin.Show();
            }
        }
    }
}